import { Suspense } from "react";
import { Switch, Route, Redirect } from 'react-router-dom'
export default function RouterView(props) {
    return (
        <Suspense fallback=''>
            <Switch>
                {
                    props.routes.map(item => {
                        return (
                            <Route key={item.path} path={item.path} component={() => {
                                return <item.component routes={item.children}></item.component>
                            }}></Route>
                        )
                    })
                }
                <Redirect exact from='/' to='/login'></Redirect>
                <Redirect exact from='/layout' to='/layout/user'></Redirect>
            </Switch>
        </Suspense>
    )
}